<?php
/**
 * Created by
 * User: 小涛
 * Date: 2018/5/29
 * Time: 9:59
 */

namespace app\admin\model;


use app\admin\service\Token;
use think\Model;

/**
 * Class UserType  管理权限
 * @package app\admin\model
 */
class UserType extends Model
{
    //列表
    public static function listUserType($listRow = 13){
        return self::order("id desc")
            -> paginate($listRow);
    }

    //判断操作权限
    public static function Jurisdiction($url = ""){
        $token = Token::getToken();
        if(!$token){
            return false;
        }
        if($token["user_type"]==null){
            return false;
        }
        $id = $token["user_type"];
        $list = self::where(["id" => $id])
            -> where("jurisdiction","like","%".$url."%")
            -> find();
        return $list;
    }
}